package com.zjs.handleMvc.controller;

import com.zjs.handleMvc.web.annotation.RequestMapping;
import com.zjs.handleMvc.web.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginController {
    @RequestMapping("/toLogin.do")
    public String toLogin(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("进入toLogin.do方法.....");
        //转发
        return "login";
    }

    @RequestMapping("/login.do")
    public String login() {
        System.out.println("进入login.do方法.....");
        //重定向
        return "redirect:toWelcome.do";
    }

    @RequestMapping("/toWelcome.do")
    public String toWelcome() {
        System.out.println("进入toWelcome.do方法.....");
        //转发
        return "welcome";
    }

    @RequestMapping("/fail.do")
    public String fail() {
        System.out.println("进入fail.do方法.....");
        //转发
        return "/toLogin.do";
    }

    @RequestMapping("/text.do")
    @ResponseBody
    public String text() {
        System.out.println("进入text.do方法.....");
        //输出文本
        return "你好呀！nice...";
    }
}
